﻿using System;

namespace SlamCms.Data
{
	public class TrackTagHit
	{
		public Guid TrackTagHitId { get; set; }
		public Guid TrackVisitId { get; set; }
		public string TagId { get; set; }
		public string TagIdentifier { get; set; }
		public DateTime Date { get; set; }
		public int? UserId { get; set; }
		public string Referrer { get; set; }

		public virtual Tag Tag { get; set; }

		public static TrackTagHit Create(Guid trackVisitId, int? userId, string tagIdentifier, string referrer = null)
		{
			return new TrackTagHit()
			{
				TrackTagHitId = Guid.NewGuid(),
				TrackVisitId = trackVisitId,
				UserId = userId,
				TagIdentifier = tagIdentifier,
				Date = DateTime.UtcNow,
				Referrer = referrer,
			};
		}
	}
}
